package com.spzx.product.controller;

import com.spzx.common.core.domain.R;
import com.spzx.common.core.web.domain.BaseEntity;
import com.spzx.common.security.annotation.InnerAuth;
import com.spzx.product.api.domain.dto.OrderStockDTO;
import com.spzx.product.service.SkuStockService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("stock")
@Tag(name="sku库存模块")
public class SkuStockController extends BaseEntity {
    @Resource
    SkuStockService skuStockService;


    @InnerAuth
    @Operation(summary = "内部调用接口：验库存锁库存")
    @PostMapping("checkAndLockStock")
    public R<List<OrderStockDTO>> checkAndLockStock(@RequestBody List<OrderStockDTO> orderStockDTOS){

        return R.ok(skuStockService.checkAndLockStock(orderStockDTOS));
    }
}



